<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload = function(){
            var oDiv = document.getElementById("div1")

            // console.log(oDiv.attributes)
            console.log(oDiv.attributes.getNamedItem("title").nodeValue)
            console.log(oDiv.attributes.getNamedItem("title").nodeName)
            console.log(oDiv.attributes.getNamedItem("title").nodeType)
            console.log("====================================================")

            console.log(oDiv.attributes["title"].nodeValue)
            console.log(oDiv.attributes["title"].nodeName)
            console.log(oDiv.attributes["title"].nodeType)

        }
    </script>
</head>
<body>
    <div id="div1" title="hello" class="box">div文本</div>
</body>
</html>